<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
    <title>狼码客户关系管理系统</title>
    <link href="/static/css/bootstrap.min.css" title="" rel="stylesheet" />
    <link title="orange" href="/static/css/login.css" rel="stylesheet" type="text/css"/>

    <script type="text/javascript" src="/static/plugins/easyui/jquery.min.js"></script>
    <script type="text/javascript" src="/static/plugins/form/jQueryForm.js"></script>

    <script>
        <shiro:authenticated>
        location.href = '/index.do'
        </shiro:authenticated>
        $(function () {
            console.log($("#submitForm"));
            $("#submitForm").ajaxForm(function (data) {

                if (data.success) {
                    //登录成功跳转页面
                    location.href = "/index.do";
                }
                else {
                    //登录失败
                    $("#login_err").html(data.msg);
                }
            })
            //发送ajax验证表单
            $(function () {
                $("#login_sub").click(function () {
                    $("#submitForm").submit();
                })
            })
        })
    </script>
</head>
<body>
<div style="height:1px;"></div>
<div class="login">
    <header>
        <h1>登陆</h1>
    </header>
    <div class="sr">
        <form id="submitForm" action="/login.do" method="post">
            <div class="name">
                <label>
                    <i class="sublist-icon glyphicon glyphicon-user"></i>
                </label>
                <input type="text" name="username" placeholder="这里输入登录名" class="name_inp" value="admin">
            </div>
            <div class="name">
                <label>
                    <i class="sublist-icon glyphicon glyphicon-pencil"></i>
                </label>
                <input type="password" name="password" placeholder="这里输入登录密码" class="name_inp" value="1">
            </div>
            <button type="button" class="dl" id="login_sub">登录</button>
        </form>
    </div>
</div>
</body>
</html>